<template>
    <div class="partyHistory_all">
        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
            <div class="title">
                <img class="back" @click="back" src="~@/assets/images/pH_back.png" alt="">
                <!-- <span class="back"></span> -->
                <span class="title_text">国寿财党史学习</span>
            </div>
            <div class="partyHistory_content">
                <div class="ph_content_topimg">
                    <img class="pH_contentTop" src="~@/assets/images/partyHistory_bg.png" alt="">
                </div>
                <div class="pH_content">
                    <div class="pH_content_c">
                        <div class="pH_content_item" v-for="(item,index) in list" @click="show(item.partyUrl)">
                            <div class="item_c">
                                <span class="item_left">{{item.partyTitle}}</span>
                                <img class="item_right" src="~@/assets/images/partyHistory_right.png" alt="">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </van-list>
    </div>
</template>
<script lang="ts">
import '../../style/reservaIndex_index.css';
import 'vant/lib/toast/style';
import 'vant/lib/dialog/style';
import { Toast } from 'vant';
import { Component, Vue, Prop } from 'vue-property-decorator';
import { cloudApi } from '@/api/indexApi';
import Header from '@/components/Header.vue';
import { Alert } from '@/utils';
import { Dialog } from 'vant';
import func from 'vue-temp/vue-editor-bridge';
import Vue from 'vue';
import { Loading } from 'vant';
import Vue from 'vue';
import { List } from 'vant';
import { cell } from "vant";

Vue.use(cell);
Vue.use(List);
const AESEncode: any = (window as any).AESEncode;
const AESDecode: any = (window as any).AESDecode;
Vue.use(Loading);
Vue.use(Dialog);
Component.registerHooks(['beforeRouteUpdate', 'beforeRouteLeave', 'beforeRouteLeave']);
@Component({
    components: { Header },
})
export default class Myinsuretwo extends Vue {

    list: any = []
    state_null: any = false
    ph_contentstate: any = false
    id: any = ''
    loading: any = false
    finished: any = false
    mounted() {
        // this.contentList()
    }
    onLoad() {
        var _this = this;
        // 异步更新数据
        // setTimeout 仅做示例，真实场景中一般为 ajax 请求
        var _this = this;
        cloudApi
            .partyHistory({
                'id': _this.id,
                'pageSize': '10'
                // url: "/app/party/list"
            })
            .then(function(res) {
                for (let i = 0; i < res.data.data.body.length; i++) {
                    _this.list.push(res.data.data.body[i]);
                    console.log(_this.list)
                }
                if (res.data.data.body[9]) {

                    _this.id = res.data.data.body[9].id
                }
                _this.loading = false;
                if (res.data.data.body.length < 10) {
                    _this.finished = true;
                }
            });
        // 数据全部加载完成

    }
    contentList() {
        var _this = this;
        cloudApi
            .partyHistory({
                'id': '',
                'pageSize': '10'
                // url: "/app/party/list"
            })
            .then(function(res) {
                for (let i = 0; i < res.data.data.body; i++) {
                    _this.list.push(res.data.data.body[i]);
                }
                _this.loading = false;
            });
    }
    show(url: any) {
        window.location.href = url
    }

    back() {
        // this.$router.push({path: '/mainPage',});
        this.$router.back();
    }
}
</script>
<style lang="less" scoped>
.partyHistory_all {
    width: 100%;
    height: 100%;
}

.title {
    position: relative;
    padding: 15px 0;
    text-align: center;
    background-color: #fff;
    font-weight: 500;
}

.title .back {
    width: 10px;
    height: 17px;
    position: absolute;
    left: 12px;
    bottom: 19px;
    color: #222222;
}

.title .title_text {
    font-size: 19px;
}

.partyHistory_content {
    width: 100%;
    height: 100%;
    overflow: scroll;
    position: relative;
}

.ph_content_topimg {
    width: 100%;
    height: 128px;
}

.pH_contentTop {
    width: 100%;
    // height: 100%;
}

.pH_content {
    // position: absolute;
    // top: 128px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.pH_content_c {
    width: 95%;
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;
}

.pH_content_item {
    width: 92.7%;
    margin: 0 13px;
    float: left;
    border-bottom: 1px solid #E9E9E9;
}

.pH_content_c .pH_content_item:last-child {
    border: none;
}

.item_c {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 19px 0;
}

.item_left {
    float: left;
    width: 270px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #222222;
}

.item_right {
    width: 4px;
    height: 7px;
    float: right;
    // margin-right: 13px;
}

.content_null {
    width: 100%;
    height: 300px;
    text-align: center;
    line-height: 300px;
    font-size: 17px;
    // color: #222;
    color: rgb(154 150 150);
}
</style>